//
//  YWHistoryHeaderCollectionReusableView.m
//  聆听FM
//
//  Created by dllo on 16/6/22.
//  Copyright © 2016年 Dark. All rights reserved.
//

#import "YWHistoryHeaderCollectionReusableView.h"

@implementation YWHistoryHeaderCollectionReusableView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.historyLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, 100, 10)];
        _historyLabel.text = @"搜索历史";
        _historyLabel.font = [UIFont systemFontOfSize:13];
        _historyLabel.textColor = [UIColor grayColor];
        [self addSubview:_historyLabel];
        
        self.cleanHistoryLabel = [[UILabel alloc] initWithFrame:CGRectMake(SCREENWIDTH - 60, 10, 50, 10)];
        _cleanHistoryLabel.text = @"清空历史";
        _cleanHistoryLabel.font = [UIFont systemFontOfSize:13];
        _cleanHistoryLabel.textColor = [UIColor colorWithRed:0.162 green:0.860 blue:1.000 alpha:1.000];
        _cleanHistoryLabel.userInteractionEnabled = YES;
        [_cleanHistoryLabel sizeToFit];
        [self addSubview:_cleanHistoryLabel];
        
        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTapCleanLabel:)];
        [_cleanHistoryLabel addGestureRecognizer:tap];
    }
    return self;
}

- (void)didTapCleanLabel:(UITapGestureRecognizer *)tap
{
    _cleanHistoryBlock();
}

@end
